/*
 * This file will contain all the shared variables in between threads
 */
#include "cli_resp.h"

/*
 * threads[0] will handle the user input
 * threads[1] will handle the command socket
 * threads[2] will handle the data socket
 */
pthread_t threads[3];


//communication buffer between thread 1 and thread 2
//will contain ftp commands and responses
RESP *t0AndT1Buf = NULL;


//mutex to lock the communication buffer between thread 1 and thread 2
pthread_mutex_t mT0AndT1;

//condition to signal if t0AndT1Buf is ready for read/writes
pthread_cond_t t0AndT1BufRdy;

//if true, start exiting all threads.  only thread 0 can modify this
bool shouldExit = false;

//mutex for should exit
pthread_mutex_t mShouldExit;

//used for communication between thread 0 and thread 2 and
//storing a directory listing
//the output of thread 0 can be the following:
//
//"l" : get a directory listing
//"d" : download a file
//"u" : upload a file
char *listBuf;

//mutex for the variable that stores a directory listing
pthread_mutex_t mListBuf;

pthread_cond_t listBufRdy;

pthread_cond_t enterPasvMode;

pthread_mutex_t dummyMutex;

pthread_mutex_t mFileSize;

//mutex for file progress of a download
pthread_mutex_t mFileProgress;


